﻿using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore;

namespace IdentityService.Infrastructure.Migrations
{
    public class AppIdentityDesignTimeDbContextFactory : IDesignTimeDbContextFactory<AppIdentityDbContext>
    {
        public AppIdentityDbContext CreateDbContext(string[] args)
        {
            DbContextOptionsBuilder<AppIdentityDbContext> builder = new DbContextOptionsBuilder<AppIdentityDbContext>();

            //string connString = "Server=.;Initial Catalog=IdentityService;Integrated Security=SSPI;Encrypt=True;TrustServerCertificate=True";
            string connString = "Server=39.107.140.217,1433;Initial Catalog=IdentityService;User=sa;Password=Yez123!!;TrustServerCertificate=True;";
            builder.UseSqlServer(
                connString,
                it => it.MigrationsHistoryTable("_MigrationsHitory")
            );
            #pragma warning disable CS8625
            return new AppIdentityDbContext(builder.Options, null);
            #pragma warning restore CS8625
        }
    }
}
